#include <iostream>

#include "SampleClass.h"
#include "LinkedList.h"

using namespace std;

//#define CSampleClass SampleClass // Old way of ADT
//typedef SampleClass CSampleClass; // New c++ way of ADT <- Use this

typedef int cost;


int main( void )
{

#if 0 // sample bubble-sort code
	int vals[11] = { 5,9,8,7,6,10,4,2,3,1,3 };

	int valSize = sizeof(vals)/sizeof(*vals);
	for ( int i = 0; i < valSize; ++i )
	{
		for ( int j = i + 1; j < valSize; ++j )
		{
			if ( vals[i] > vals[j] )
			{
				// switch
				int tempVal = vals[i];
				vals[i] = vals[j];
				vals[j] = tempVal;
			}
		}
	}

	for ( int i = 0; i < valSize; ++i )
	{
		cout << vals[i] << " ";
	}
#endif

	int costumerCost1;
	cost costumerCost2;
	cost costumerCost3;

	int *pPointer = NULL; // Always set it to null if not going to use immediately.
	int *pNum = new int;
	*pNum = 10;
	delete pNum;
	pNum = NULL; // Always remember to set the pointer to null after use!!!
	//*pNum = 5; // This will crash the program.


	// Using our linked-list
LinkedList list;

	bool bLoop = true;
	while ( bLoop )
	{
		system( "cls" );

		int choice, num;
		cout << "1.) Add new number." << endl;
		cout << "2.) Display list then remove." << endl;
		cout << "3.) Remove top node." << endl;
		cout << "4.) Clear List." << endl;
		cout << "5.) Size of list." << endl;
		cout << "6.) Exit." << endl;

		cin >> choice;
		system( "cls" );

		switch( choice )
		{
		case 1:
			cout << "Enter new number: ";
			cin >> num;
			list.AddNode(num );
			break;
		case 2:
			while ( list.GetTopNode() != NULL )
			{
				cout << list.GetTopNode()->data << endl;
				list.RemoveTopNode();
			}
			break;
		case 3:
			list.RemoveTopNode();
			break;
		case 4:
			list.ClearList();
			break;
		case 5:
			cout << "Size of list: " << list.GetSize();
			break;
		case 6:
			bLoop = false;
			break;
		}

		system( "pause" );
	}

	return 0;
}